/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.domain;

import com.comac.ins.common.mybatis.core.page.PageQuery;
import com.comac.ins.isfd.constant.enums.IsfdMongoQueryLogicalOperatorEnum;
import com.comac.ins.isfd.constant.enums.IsfdMongoQueryOperatorEnum;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.util.List;


/**
 * mongoDB查询条件构造
 *
 * @author lj
 * @date 2025-01-13
 */
@Data
public class IsfdDatabaseMongoQuery {

    /**
     * 查询条件
     */
    @NotNull(message = "condition不能为空!")
    private List<IsfdDatabaseMongoQueryCondition> conditions;

    /**
     * 分页条件
     */
    private PageQuery pageQuery;

    @Data
    public static class IsfdDatabaseMongoQueryCondition {
        /**
         * 字段名称
         */
        @NotBlank(message = "fieldName不能为空!")
        private String fieldName;

        /**
         * 逻辑操作符
         * @see IsfdMongoQueryLogicalOperatorEnum
         */
        private String logicalOperator;

        /**
         * 操作符
         * @see IsfdMongoQueryOperatorEnum
         */
        @NotBlank(message = "operator不能为空!")
        private String operator;

        /**
         * 值
         */
        @NotBlank(message = "value不能为空!")
        private String value;

        /**
         * 是否校验value字段是纯数字
         */
        private Boolean valueNumberCheck = Boolean.FALSE;
    }

}
